home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_25_1988_Transactor_Publishing.d64
/
palvert64 1.0
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
5KB
|
129 lines
20 rem ****************************************
30 rem * convert cbm assembler source file to *
40 rem * file to pal assembler source file *
50 rem * k.j.h. hildon 03/83 *
60 rem * ======= palvert64 1.0 ========= *
70 rem * works on c64 with disk *
80 rem * absolutely no copyright restrictions *
90 rem ****************************************
100 i$="abcdefghijklmnopqrstuvwxyz1234" : rem i$ must be 1st var used
110 i$=i$+i$+i$ : rem establish input buffer
120 mc=896 : rem mach code start addr
130 rem *** string input routine -- by jim butterfield ***
140 data 160, 2, 177, 45, 153, 137, 0, 200, 192, 6, 208, 246, 162, 1
150 data 32, 198, 255, 32, 228, 255, 201, 13, 240, 15, 164, 142, 145, 140
160 data 200, 132, 142, 196, 139, 240, 4, 165, 144, 240, 234, 76, 204, 255
170 restore : for j=mc to mc+41 : read x : poke j, x : t=t+x : next
180 if t<>6120 then print"typo in data" : stop
190 z$=chr$(0) : cd=8 : pd=8 : od=8 : cn=0 : print chr$(14)
200 sa=2049 : rem start addr c64
210 sl=100 : rem starting line #
220 ic=10 : rem increment
230 gosub 270
240 print : input "append to existing pal file (y/n)";yn$
250 if yn$="y" then 900
260 gosub 360 : gosub 450 : goto 520
270 print : input "cbm source filename";cn$
280 print tab(20)cn"[145]"
290 input " source drive";cn
300 print tab(20)cd"[145]"
310 input " source device#";cd
320 cn$=mid$(str$(cn),2)+":"+cn$
330 open 1, cd, 8, cn$ : ed=cd : gosub 700 : close 1
340 if e then print ee$ : print : goto 270
350 return
360 print : input " new pal filename";pn$
370 print tab(20)cn"[145]"
380 input " destination drive";pn
390 print tab(20)pd"[145]"
400 input "destination device#";pd
410 pn$=mid$(str$(pn),2)+":"+pn$
420 open 2, pd, 6, pn$ : ed=pd : gosub 700 : close 2
430 if e<>62 then print "file exists" : print : goto 360
440 print : return
450 a=sl : print : print tab(20)sl"[145]"
460 input " starting line #";sl
470 if sl<a then print"must be > or = !" : sl=a : goto 450
480 print tab(20)ic"[145]"
490 input " line increment";ic
500 print : return
510 rem ** open input and output files **
520 open 1, cd, 8, cn$
530 open 2, pd, 6, pn$+",p,w"
540 a=sa : gosub 660 : rem output file start addr ($0801)
550 sys mc : sx=st : rem input line from cbm source file
560 a$=left$(i$,peek(142))
570 sa=sa+len(a$)+5 : rem start addr + line len + 5 for link,line,mkr
580 a=sa : gosub 660 : rem output line link - hex lo, hex hi
590 a=sl : gosub 660 : rem output line # - hex lo, hex hi
600 printsl;a$ : rem ===== remove for better speed ======
610 sl=sl+ic : rem increment line number
620 print#2, a$z$; : rem output line, chr$ zero
630 if sx=0 then 550
640 close 2 : close 1 : goto 760
650 ** output 2 hex bytes **
660 print#2, chr$(a and 255);
670 print#2, chr$(int(a/256));
680 return
690 ** error input **
700 open 15, ed, 15
710 input#15, e, e$, et, es
720 ee$=str$(e)+","+e$+","+ str$(et)+","+str$(es)
730 close 15
740 return
750 rem ** add more cbm source modules **
760 print
770 print "([196][207] [206][207][212] exit with <[210][197][212][213][210][206]>)
775 [133]"atnppend another file ncmdcmdcmd";yn$
780 [139] yn$[178]"y" [167] 840
790 [159] 2, pd, 6, pn$[170]",a"
800 [152]2, z$z$; : [143] add end file marker ($00, $00)
810 [160] 2 : [160] 15
820 [153] "load";[199](34);pn$;[199](34);","[202]([196](pd),2)"ononon"
830 [128]
840 [141] 270 : [143] for new cbm file name
850 [141] 450 : [143] alter next line number, increment
860 [159] 1, cd, 8, cn$
870 [159] 2, pd, 6, pn$[170]",a"
880 [137] 550 : [143] go add file
890 [143] ** append cbm source to existing pal file **
900 [153] : [133] " old pal filename";op$
910 [153] [163]20)cn"on"
920 [133] " drive";op
930 [153] [163]20)od"on"
940 [133] " device#";od
950 [159] 1, od, 8, op$ : ed[178]od : [141] 700 : [160] 1
960 [139] e [167] [153] ee$ : [153] : [137] 900
970 [153] : [153] [163]21)"@"op$"on"
980 [133] " new pal filename";pn$
990 [139] [200](pn$,1)[179][177]"@" [167] 1010
1000 pn[178]op : pd[178]od : pn$[178]"@"[170][202]([196](pn),2)[170]":"[170][202](pn$,2) : [137] 1080
1010 [153] [163]20)cn"on"
1020 [133] " destination drive";pn
1030 [153] [163]20)pd"on"
1040 [133] "destination device#";pd
1050 pn$[178][202]([196](pn),2)[170]":"[170]pn$
1060 [159] 2, pd, 6, pn$ : ed[178]pd : [141] 700 : [160] 2
1070 [139] e[179][177]62 [167] [153] " file exists" : [153] : [137] 970
1080 [153] : [153]"creating new file from ";op$;" stand by..."
1090 [159] 1, od, 8, op$[170]",p,r"
1100 [159] 2, pd, 6, pn$[170]",p,w"
1110 [161]#1,a$ : [152]2, [199]([198](a$[170]z$)); : [143] file start address
1120 [161]#1,a$ : [152]2, [199]([198](a$[170]z$));
1130 [161]#1, b$, c$ : [139] st[178]64 [167] 1230 : [143] get line link
1140 a$[178][199]([198](b$[170]z$)) [170] [199]([198](c$[170]z$))
1150 [161]#1, b$, c$ : [143] get line number
1160 a$[178]a$ [170] [199]([198](b$[170]z$)) [170] [199]([198](c$[170]z$))
1170 [151] mc[170]21, 0 : [143] input delim now $00
1180 [158] mc
1190 a$[178]a$[170][200](i$,[194](142))[170]z$ : [143] +z$ to add lost mkr
1200 [152]2,a$;
1210 sa[178]sa[170][195](a$) : [143] update start addr
1220 [137] 1130
1230 [160] 1
1240 [151] mc[170]21, 13 : [143] input delim back to cr
1250 sl[178][198]([202](a$,3)[170]z$)[170][198]([202](a$,4)[170]z$)[172]256[170]ic
1260 [141] 450 : [143] alter next line num
1270 [159] 1, cd, 8, cn$[170]",s,r"
1280 [137] 550